<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich">
    <style>
        .treeRow{
            vertical-align:top;
        }
    </style>
    <h:form id="aa">
        <rich:panel header="费用项目" id="costtree" styleClass="content-hight">
            <rich:messages globalOnly="true"/>
            <rich:toolbar  itemSeparator="grida">
                <rich:toolbarGroup>
                    <a4j:commandButton value="新增"  render="costinfo" action="#{coitem.addDepartment}" >
                    </a4j:commandButton>
                    <a4j:commandButton value="保存"  render="costtree" action="#{coitem.savaDepartment}" >
                    </a4j:commandButton>
                    <a4j:commandButton value="修改"  render="costtree" action="#{coitem.updateDept}" >
                    </a4j:commandButton>
                    <a4j:commandButton value="删除"  render="costtree" action="#{coitem.checkDeteleCostitem}" >
                    </a4j:commandButton>
                </rich:toolbarGroup>
            </rich:toolbar>
            <h:panelGrid columns="2" width="100%" border="0" id="costform">
                <h:panelGroup>
                    <rich:tree style="width:300px;text-align:left;"  selectionType="ajax" toggleType="client" render="costinfo"
                               value="#{coitem.rootNode}" selectionChangeListener="#{coitem.selected}" var="idept">
                        <rich:treeNode>
                            <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                        </rich:treeNode>
                    </rich:tree>
                </h:panelGroup>
                <h:panelGroup id="costinfo">                   
                    <h:panelGrid columns="3">
                        <h:outputText value="费用代码:"/>
                        <h:inputText  disabled="#{coitem.showAble||coitem.editAble}" id="code"  value="#{coitem.coitem.code}" />
                        <rich:message for="code"/>
                        <h:outputText value="费用名称:"/>
                        <h:inputText  disabled="#{coitem.showAble}" id="name"  value="#{coitem.coitem.name}" />
                        <rich:message for="name"/>
                    </h:panelGrid>
                </h:panelGroup>
            </h:panelGrid>
        </rich:panel>
       </h:form>
</ui:composition>
